package com.trippin.DB.entities;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.gson.annotations.Expose;

@PersistenceCapable
public class Link implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	Key key;
	
	@Persistent
	@Expose
	long id;
	
	@Persistent
	@Expose
	private String lable;
	
	@Persistent
	@Expose
	private String url;
	
	public Link() {}
	
	public Link(String lable, String url) {
		this.lable = lable;
		this.url = url;
		this.id = -1;
	}

	public long getId() {
		if(id < 0)
			id = key.getId();
		return id;
	}


	public void setId() {
		id = key.getId();
	}

	public String getLable() {
		return lable;
	}

	public void setLable(String lable) {
		this.lable = lable;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}
}
